<template>
	<view class="industryAttributePopup-content">
		<scroll-view scroll-y="true" class="scroll-Y">
			<view class="industry-list">
				<view @click="chooseIndustry(item, index)" v-for="(item, index) in industryList" :key="index" class="industry-item">
					<view class="industry-title">
						<view class="title-text">{{ item.textLanguage }}</view>
						<view class="industry-checkBox">
							<image v-if="item.code == formData.industryAttribute" class="Checked icon" src="@/static/addStore/checked.png" alt="" />
							<image v-else class="noCheck icon" src="@/static/addStore/noCheck.png" alt="" />
						</view>
					</view>
					<view class="industry-desc">{{ item.descLanguage }}</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script setup>
const industryList = defineModel();

const emit = defineEmits(['chooseIndustry']);

const props = defineProps({
	formData: {
		type: Object,
		default: () => {}
	}
});

// 选择行业
const chooseIndustry = (item, index) => {
	// console.log(item, index);
	emit('chooseIndustry', item);
};
</script>

<style lang="scss" scoped>
.industryAttributePopup-content {
	position: relative;
	padding: 20rpx 52rpx 0px;
	
	::-webkit-scrollbar {
		display: none;
		width: 0 !important;
		height: 0 !important;
		-webkit-appearance: none;
		background: transparent;
	}
	
	.scroll-Y {
		height: 400rpx;
	}

	.industry-list {
		width: 100%;
		height: 100%;

		.industry-item {
			display: flex;
			flex-direction: column;
			justify-content: center;
			height: 132rpx;
			border-bottom: 2rpx solid #f0f0f0;

			&:last-child {
				border-bottom: none;
			}

			.industry-title {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 16rpx;

				.title-text {
					font-family: PingFang SC;
					font-size: 28rpx;
					font-weight: 500;
					line-height: 40rpx;
					color: #333;
				}

				.industry-checkBox {
					.icon {
						width: 32rpx;
						height: 32rpx;
					}
				}
			}

			.industry-desc {
				font-family: PingFang SC;
				font-size: 20rpx;
				font-weight: 400;
				line-height: 28rpx;
				color: #999;
				max-width: 540rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
			}
		}
	}
}
</style>
